<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }

        div{
            width: 500px;
            height: 500px;
            background-color: skyblue;
            margin: 30px;
            overflow: hidden;
        }


        p{
            width: 300px;
            height: 300px;
            background-color: orange;
            margin: 30px;
            overflow: hidden;
        }


        span{
            width: 100px;
            height: 100px;
            display: block;
            background-color: pink;
            margin: 30px;
        }

        ul{
            width: 300px;
            height: 300px;
            padding: 30px;
            border: 30px solid #666;
            background-color: greenyellow;
            background-clip: content-box;

            border-top-width: 50px;
            border-left-width: 100px;
        }

    </style>
</head>
<body>
    <div>
        <p>
            <span>

            </span>
        </p>
    </div>
    <ul>

    </ul>

    <script>
        // var spanele = document.querySelector('span');
        // console.log('定位父级',spanele.offsetParent); // body是span的定位父级 


        // console.log(spanele.offsetLeft);// 90 span->p 30 p->div 30 div->body 30
        // console.log(spanele.offsetTop);// 90 span->p 30 p->div 30 div->body 30

        // var ulele =  document.querySelector('ul');

        // console.log(ulele.clientLeft); // 左边框的大小
        // console.log(ulele.clientTop); // 上边框的大小

    </script>
</body>
</html>